package com.ss.android.common.app;

import android.os.Bundle;
import android.support.v4.app.FragmentActivity;

public class AbsFragmentActivity extends FragmentActivity{
	protected boolean mStatusActivity=false;
	protected boolean mStatusDestroyed=false;
	
	protected boolean enableInitHook(){
		return true;
	}
	
	protected boolean enableMobClick(){
		return true;
	}
	
	public boolean isActive(){
		return this.mStatusActivity;
	}
	
	public boolean isDestoryed(){
		return this.mStatusDestroyed;
	}
	
	protected void onCreate(Bundle savedInstanceState){
		super.onCreate(savedInstanceState);
		if(enableMobClick()){
			//MobClickCombiner.onError(this);
		}
		AppHooks.InitHook initHook=AppHooks.getInitHook();
		if(initHook!=null&&enableInitHook()){
			initHook.tryInit(this);
		}
	}
	
	protected void onDestory(){
		super.onDestroy();
		this.mStatusDestroyed=true;
	}
	
	protected void onPause(){
		super.onPause();
		this.mStatusActivity=false;
		if(enableMobClick()){
			//MobClickCombiner.onPause(this);
		}
		AppHooks.ActivityLifeCycleHook lifeCycleHook=AppHooks.getActivityHook();
		if(lifeCycleHook!=null){
			lifeCycleHook.onActivityPaused(this);
		}
	}
	
	protected void onResume(){
		super.onResume();
		this.mStatusActivity=true;
		if(enableMobClick()){
			//MobClickCombiner.onResume(this);
		}
		AppHooks.ActivityLifeCycleHook lifeCycleHook=AppHooks.getActivityHook();
		if(lifeCycleHook!=null){
			lifeCycleHook.onActivityResumed(this);
		}
	}
	
	protected void onStop(){
		super.onStop();
		this.mStatusActivity=false;
	}
}
